@extends('Admin.layout.layout')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>考察预约管理</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <form action="" method="get">
                                {{csrf_field()}}
                                <div class="col-sm-12">
                                    <button type="submit" class="btn btn-sm btn-primary fr">查询</button>
                                    <div class="input-group fr mr10 ">
                                        <input type="text" placeholder="考察区域/预约人姓名/电话/公司名称" class="input-sm form-control" name="keyword" value="{{$search_params['keyword']}}">
                                    </div>
                                    <div class="input-group fr mr10 ">
                                        <select style="float: left; margin-right: 10px;padding: 0;" title="" class="input-sm form-control"  name="type">
                                            <option value="">请选择类型</option>
                                            <option value="1" @if(1 == $search_params['type']) selected="selected"@endif>供应链金融</option>
                                            <option value="2" @if(2 == $search_params['type']) selected="selected"@endif>产业园区</option>
                                            <option value="3" @if(3 == $search_params['type']) selected="selected"@endif>一带一路</option>
                                        </select>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <table class="table table-striped table-bordered table-hover dataTable" id="editable">
                            <thead>
                                <tr>
                                    <th>序号</th>
                                    <th width="300">考察区域</th>
                                    <th class="center">预约类型</th>
                                    <th class="center">预约人姓名</th>
                                    <th class="center">预约人电话</th>
                                    <th class="center">公司名称</th>
                                    <th class="center">提交时间</th>
                                    <th class="center">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                @if(!empty($list))
                                    @foreach($list as $k =>$v)
                                    <tr class="gradeX">
                                        <td>{{$v['id']}}</td>
                                        <td>{{$v['park_title']}}</td>
                                        <td class="center">{{$v['park_type_name']}}</td>
                                        <td class="center">{{$v['park_name']}}</td>
                                        <td class="center">{{$v['park_phone']}}</td>
                                        <td class="center">{{$v['park_company']}}</td>
                                        <td class="center">{{!empty($v['created_at'])?$v['created_at']:$v['updated_at'] }}</td>
                                        <td class="center">
                                            <a class="btn-xs btn-primary"  data-toggle="modal" data-target="#checkModel" data-id="{{$v['id']}}" data-title="{{$v['park_title']}}" data-name="{{$v['park_name']}}" data-type="{{$v['park_type_name']}}" data-leave="{{$v['park_leaveWord']}}" data-company="{{$v['park_company']}}" data-phone="{{$v['park_phone']}}"

                                            >
                                                查看留言
                                            </a>
                                        </td>
                                    </tr>
                                    @endforeach
                                @else
                                    <tr class="no-records-found center"><td colspan="9">没有找到匹配的记录</td></tr>
                                @endif
                            </tbody>
                        </table>
                        <div class="row">
                            @include('Admin.common.paginate')
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="checkModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">×
                    </button>
                    <h4 class="modal-title" id="myModalLabel">查看预约信息</h4>
                </div>
                <form class="form-horizontal m-t" id="editForm">
                    <div class="modal-body">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">预约人：</label>
                            <div class="col-sm-8">
                                <p class="form-control-static park_name" >公司名称</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">联系方式：</label>
                            <div class="col-sm-8">
                                <p class="form-control-static park_phone" >2018-1-12 12:12:10</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">公司名称：</label>
                            <div class="col-sm-8">
                                <div class="radiolist i-checks">
                                    <p class="form-control-static park_company" ></p>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">留言信息：</label>
                            <div class="col-sm-4">
                                <p class="form-control-static park_leaveWord">

                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default"
                                data-dismiss="modal" >关闭
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <script src="{{asset('js/plugins/layer/laydate/laydate.js')}}"></script>
    <script src="{{asset('js/plugins/layer/layer.min.js')}}"></script>

    <script>
        //点击查看
        $('#checkModel').on('show.bs.modal', function (e) {
            // 公司名称
            var title = $(e.relatedTarget).attr("data-title");
            var name = $(e.relatedTarget).attr("data-name");
            var type = $(e.relatedTarget).attr("data-type");
            var phone = $(e.relatedTarget).attr("data-phone");
            var company = $(e.relatedTarget).attr("data-company");
            var park_leaveWord = $(e.relatedTarget).attr("data-leave");

            $('.park_name').html(name);
            $('.park_phone').html(phone);
            $('.park_title').html(title);
            $('.park_company').html(company);
            $('.park_leaveWord').html(park_leaveWord);
        });
    </script>
@endsection

@section("after.js")
    @include('Admin.components.modal.delete',['title'=>'操作提示','content'=>'你确定要删除这条预约记录吗?'])
@endsection